function next() {
    var param = $.paramToObj();
    ajax({
        url: "/api/user/channelBind",
        type: "post",
        dataType: "json",
        headers: {},
        data: {
            channel: param.channel,
            secret: param.secret,
            regid:getClientInfo(),
            type:osName(),
            mobile: $.trim($("input[name=mobile]").val()),
            vfCode: $.trim($("input[name=code]").val())
        },
        success: function (result) {
            switch (result.code) {
                case 106:
                case '106': {
                    toast(result.msg);
                    openWebview('account-m-password', {
                        channel: param.channel,
                        secret: param.secret,
                        mobile: $.trim($("input[name=mobile]").val()),
                        vfCode: $.trim($("input[name=code]").val())
                    });
                    break;
                }
                case 0:
                case '0': {
                    toast(result.msg);
                    setLocalItem("user", new AppUserBean(result.data));
                    closeWebview("account-login");
                    evalJs("my-index",'reload()');
                    closeWebview();
                    break;
                }
                default: {
                    toast(result.msg);
                }
            }
        }
    });
}

var isSending = 0;

function send(_this) {
    if (isSending) {
        return false;
    } else {
        isSending = 60;
        var mobile = $.trim($("input[name=mobile]").val());
        if (mobile === '') {
            toast('请填写手机号！');
            isSending = 0;
            return false;
        }
        ajax({
            url: "/api/sms/vfCode",
            type: "post",
            dataType: "json",
            headers: {},
            data: {mobile: mobile, type: 'channelRegister'},
            success: function (result) {
                toast(result.msg);
            }
        });
        var $this = $(_this);
        $this.html(isSending + "S");
        var interval = setInterval(function () {
            if (isSending) {
                $this.html((--isSending) + "S");
            } else {
                $this.html('获取验证码');
            }
        }, 1000);
    }
}

function onPageReady() {
}